<template>
  <a-card :bordered="false" title="" class="mt-6">
    <div>
      <span>开关状态</span>
      <a-radio-group class="ml-4" v-model="value" @change="onChange">
        <a-radio value="1"> 开启 </a-radio>
        <a-radio value="0"> 关闭 </a-radio>
      </a-radio-group>
    </div>
  </a-card>
</template>

<script>
export default {
  data() {
    return {
      value: '',
    }
  },
  created() {
    this.axios.get('/a/api-switch').then((res) => {
      this.value = res.data.data
    })
  },
  methods: {
    onChange() {
      this.axios.put('/a/api-switch', { val: this.value }).then((res) => {
        this.$message.success('设置成功!')
      })
    },
  },
}
</script>

<style>
</style>